package com.button.springbootclickhouse.controller;

import com.button.springbootclickhouse.entity.Order;
import com.button.springbootclickhouse.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * @Description
 * @Author Administrator
 * @Date 2023/1/30 16:14
 **/
@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("save")
    public void saveOrder() {
        Order order = new Order();
        order.setId(1L);
        order.setOrderName("order2");
        order.setTotalAmount(321.354D);
        order.setCreateTime(new Date());
        orderService.saveOrder(order);
    }

    @GetMapping("getOrderList")
    public List<Order> getOrderList() {
        return orderService.getOrderList();
    }
}
